<{include file='public/head'}>

<div class="layui-body">
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">扩展字段列表</li>
	    <li lay-id="t2">扩展字段新增</li>
	  </ul>
	  <div class="layui-tab-content">
	  	 <div class="layui-tab-item layui-show">
		   <form action="<{:url('/Extfiel/index/')}>" method="get" class="layui-form">
			<div class="layui-form-item nospace">
				<div class="layui-input-inline">
				   <select name="mcode" lay-verify="required">
					<option value="">请选择内容模型</option>
					<{volist name="$models" id="value"}>
		             <option value="<{$value->mcode}>"><{$value->name}></option>
		           <{/volist}>
				   </select>
				</div>
				 <div class="layui-input-inline">
					<button class="layui-btn" lay-submit>搜索</button>
				 </div>
			</div>
            </form>
			<form class="layui-form" method="post" id="contentForm" name="contentForm">
	  	   		<table class="layui-table">
	            	<thead>
	                    <tr>
							<th><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
	                    	<th>序号</th>
							<th>内容模型</th>
	                        <th>字段描述</th>
	                        <th>字段名称</th>
	                        <th>字段类型</th>
	                        <th>排序</th>
							<th>必填</th>
	                        <th>操作</th>
	                    </tr>
	                </thead>
	                <tbody>
						<{volist name="extfields" id="value"}>
	                    <tr>
							<td>
								<input type="checkbox" class="checkbox checkitem" lay-ignore name="Del[]" value="<{$value->id}>">
		                    	<input type="hidden" name="listall[]" value="<{$value->id}>">
							</td>
	                    	<td><{$i}></td>
	                    	<td>
							<{volist name="models" id="li"}>
							<{if condition="$li->mcode eq $value->mcode"}>
								<{$li->name}>
							<{/if}>                   	
			                <{/volist}>
							</td>
	                        <td><{$value->description}></td>
	                        <td><{$value->name}></td>
	                        <td>
	                        	<{if condition="$value->type eq 1"}>单行文本<{/if}>
	                    		<{if condition="$value->type eq 2"}>多行文本<{/if}>
	                    		<{if condition="$value->type eq 3"}>单选按钮<{/if}>
	                    		<{if condition="$value->type eq 5"}>图片上传<{/if}>
	                    		<{if condition="$value->type eq 9"}>下拉选择<{/if}>
							</td>
							<td class="table-input"><input type="text" name="Sort[<{$value->id}>]" lay-ignore class="layui-input" value="<{$value->sorting}>"></td>
							<td class="table-input">
								<{if condition="$value->isture"}>
		                         <a href="<{:url('/Extfiel/mod/id/'.$value->id.'/field/isture/value/0')}>"><i class='fa fa-toggle-on' title="点击禁用"></i></a>
		                         <{else}>
		                          <a href="<{:url('/Extfiel/mod/id/'.$value->id.'/field/isture/value/1')}>"><i class='fa fa-toggle-off' title="点击启用"></i></a>
		                        <{/if}>
							</td>
	                        <td>
	                            <{:get_btn_del($value->id,'Extfiel')}>
	                            <{:get_btn_mod($value->id,'Extfiel')}>
	                        </td>
	                    </tr>
	                    <{/volist}>
	                </tbody>
	            </table>
				<button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn layui-btn-danger">批量删除</button>
				<button type="submit" name="submit" onclick="return setSortAction();" value="sorting" class="layui-btn">保存排序</button>
				 <script>
					function setDelAction(){
						document.contentForm.action = "<{:url('del')}>";
						return confirm("您确定要删除选中的内容么？");
					}
					function setSortAction(){
						document.contentForm.action = "<{:url('sort')}>";
						return confirm("您确定要进行排序？");
					}
				</script>
				<div class="page"><{$extfields->render()}></div>
			</form>
	  	   </div>


	  	    <div class="layui-tab-item">
	   			<form action="<{:url('/Extfiel/add')}>" method="post" class="layui-form">
	   				<input type="hidden" name="formcheck" value="{$formcheck}" >
					<div class="layui-form-item">
	                     <label class="layui-form-label">内容模型</label>
	                     <div class="layui-input-block">
	                     	 <select name="mcode" required lay-verify="required"> <!--lay-verify="required"--->
		                        <option value="">请选择模型</option>
								<{volist name="$models" id="value"}>
								 <option value="<{$value->mcode}>"><{$value->name}></option>
							   <{/volist}>
		                    </select>
	                     </div>
	                </div>
	                <div class="layui-form-item">
	                     <label class="layui-form-label">字段描述</label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="description" required lay-verify="required"  placeholder="请输入字段描述，如：姓名 性别" class="layui-input">
	                     </div>
	                </div>

	                <div class="layui-form-item">
	                     <label class="layui-form-label">字段名称</label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="name" required maxlength="20" lay-verify="required"  placeholder="请输入字段名称,字母、数组、下划线，如：name sex" class="layui-input">
	                     </div>
	                </div>
	                <div class="layui-form-item">
	                     <label class="layui-form-label">字段类型</label>
	                     <div class="layui-input-block">
	                     	 <select name="type" lay-verify="required">
		                    	<option value="1">单行文本</option>
		                    	<option value="2">多行文本</option>
		                    	<option value="3">单选按钮</option>
		                    	<option value="5">图片上传</option>
		                    	<option value="9">下拉选择</option>
		                    </select>
	                     </div>
	                </div>

	                <div class="layui-form-item">
	                     <label class="layui-form-label">选择按钮值</label>
	                     <div class="layui-input-block">
	                     	<textarea name="value" placeholder="多个值用英文逗号隔开或者回车"  class="layui-textarea"></textarea>
	                     	<div class="layui-form-mid layui-word-aux">只在类型为单选或多选时填写有效。</div>
	                     </div>
	                </div>
					<div class="layui-form-item">
                     <label class="layui-form-label">备注说明</label>
                     <div class="layui-input-block">
                     	<textarea name="beizhu" placeholder="备注说明"  class="layui-textarea"></textarea>
                     	<div class="layui-form-mid layui-word-aux">备注说明，用于前台表单备注说明</div>
                     </div>
                </div>
	                <div class="layui-form-item">
	                     <label class="layui-form-label">排序</label>
	                     <div class="layui-input-block">
	                     	<input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
	                     </div>
	                </div>
					<div class="layui-form-item">
	                     <label class="layui-form-label">必填？</label>
	                     <div class="layui-input-block">
							<input type="radio" name="isture" value="0" checked class="layui-input">非必填
	                     </div>
						 <div class="layui-input-block">
	                     	<input type="radio" name="isture" value="1" class="layui-input">必填
	                     </div>
	                </div>
	   				<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button class="layui-btn" lay-submit>立即提交</button>
						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
						 </div>
					</div>
	   			</form>
	   	 	</div>
	   </div>
	 </div>
</div>
<{include file='public/foot'}>